package com.itwn.portal.service;

import com.itwn.portal.entity.Tag;
import com.itwn.portal.mapper.TagMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TagService {
    @Autowired
    TagMapper tagMapper;

    @Cacheable(value = "tag",key = "#root.methodName+#root.args")
    public List<Tag> queryAll() {
        return tagMapper.selectAll();
    }

    @Cacheable(value="tag",keyGenerator = "myGenerateKey")
    public String queryName(Integer id) {
        return this.tagMapper.getName(id);
    }
}

